//方法
function strToJson(str){  
     var json = eval('(' + str + ')');  
     return json;  
}  

function showAuto() 
{ 
	n = n >=(count - 1) ? 0 : ++n; 
	$("#banner li").eq(n).trigger('click'); 
} 
function hit_love(catid,id,hid)
{
	var hid = hid ? hid : '#number_';
	var n = 2;n++;
	
	$(hid+id).html(n);
}
function hit_love(catid,id,mid,hid,username){
	if(username=='')
	{
		alert('您还没登陆!');	
		return false;
	}
	var hid = hid ? hid : '#number_';
	var saveid = GetCookie('loveid');
	valueid = 'l-'+id+'-'+mid;
/*	if (saveid == valueid) {
		alert("您已经喜欢过了O(∩_∩)O哈哈~");
	} else{}*/

		$.get("/index.php?m=content&c=love&a=love",
			  { modelid:mid, catid: catid, id:id},
			  function (r){
			   $(hid+id).html(r);
			  });
		SetCookie('loveid',valueid,1);
	}
function fensi(username,uid,show,n)
{
 	if(show)
	{
		alert('不能关注自己!');	
		return false;
	}
 	$.get("/index.php?m=member&c=space&a=guanzu1",
			  { username:encodeURIComponent(username), uid:uid, n:n},
			  function (r){
				if(r==3)
				{
					alert('您还没登陆!');	
					return false;
				}
				else if(r==2)
				{
					$('#guanzhu').html('已关注!');
				}
				else
				{
					$('#guanzhu').html(r);	
					return false;
				}
			   
			  });
 
}
function GetCookie(c_name)
{
    if (document.cookie.length > 0)
    {
        c_start = document.cookie.indexOf(c_name + "=")
        if (c_start != -1)
        {
            c_start = c_start + c_name.length + 1;
            c_end   = document.cookie.indexOf(";",c_start);
            if (c_end == -1)
            {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return null
}
 
function SetCookie(c_name,value,expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); //使设置的有效时间正确。增加toGMTString()
}

//tabs
$(document).ready(function(){ 
	var curLi; 
	$(".outTab a").mouseover(function(){ 
	curLi=$(this); 
	}); 
		$(".outTab a").hover(function(){//鼠标点击也可以切换 
		$(".travelShow").removeClass("travelShow"); 
		$(".travelHide").eq($(".outTab a").index(curLi)).addClass("travelShow"); 
		$(".hover").removeClass("hover"); 
		curLi.addClass("hover"); 
		}); 
}); 


//tabsdomestic
$(document).ready(function(){ 
	var curLi; 
	$("#domestic a").mouseover(function(){ 
	curLi=$(this); 
	}); 
		$("#domestic a").hover(function(){//鼠标点击也可以切换 
		$(".domesticShow").removeClass("domesticShow"); 
		$(".domesticHide").eq($("#domestic a").index(curLi)).addClass("domesticShow"); 
		$(".domesticHover").removeClass("domesticHover"); 
		curLi.addClass("domesticHover"); 
		}); 
}); 

//bycarTab
$(document).ready(function(){ 
	var curLi; 
	$(".bycarTab a").mouseover(function(){ 
	curLi=$(this); 
	}); 
		$(".bycarTab a").hover(function(){//鼠标点击也可以切换 
		$(".bycarShow").removeClass("bycarShow"); 
		$(".bycarHide").eq($(".bycarTab a").index(curLi)).addClass("bycarShow"); 
		$(".bycarHover").removeClass("bycarHover"); 
		curLi.addClass("bycarHover"); 
		}); 
}); 

//bycarTab
$(document).ready(function(){ 
	var curLi; 
	$(".travelHot li").mouseover(function(){ 
	curLi=$(this); 
	}); 
		$(".travelHot li").click(function(){//鼠标点击也可以切换 
		$(".yjShow").removeClass("yjShow"); 
		$(".yjHide").eq($(".travelHot li").index(curLi)).addClass("yjShow"); 
		$(".hoverHot").removeClass("hoverHot"); 
		curLi.addClass("hoverHot"); 
		}); 
}); 



